package com.hxci.zhangcong.servcie;

import com.hxci.zhangcong.dao.UserMapper;
import com.hxci.zhangcong.pojo.User;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserServcie{
    @Autowired
    private UserMapper dao;

    @Override
    public Integer logion(String name, String pass, HttpServletRequest request) {
        User user = dao.login(name,pass);
        if(user==null){
            return 0;
        }
        //登录成功后将用户存到session中
        request.getSession().setAttribute("user",user);
        return 1;
    }
}
